/*
  DC Motor driver class (BD6211F module(by Switch Science) and Toshiba TA7291)
  Hitoshi Yamada <ouch@emergeplus.jp>
  
  History:
	26/August/09 - V0.1 released.
	

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

class DCMotor {
private:
  int Mode;
  int MotorVIN;
  int BoardVIN;
  int FIN;
  int RIN;
  int VREF;
    
public:
  static const int PWM_MODE = 0;
  static const int VREF_MODE = 1;

  // VREF Mode Initializer
  void Init(int FINpin, int RINpin, int VREFpin, int motorVIN, int boardVIN);

  // PWM Mode Initializer
  void Init(int FINpin, int RINpin);

  // Break
  void Break(void);
  
  // Break with interval
  void Break(int interval);
  
  // Free
  void Free(void);
  
  // Free with interval
  void Free(int interval);
    
  // Forward
  // int speed; 0 - 255
  void Forward(int speed);
  
  // Forward with interval
  void Forward(int speed, int interval);
  
  // Backward
  // int speed; 0 - 255
  void Backward(int speed);
  
  // Backward with interval
  void Backward(int speed, int interval);
};
